﻿@model SummaryModel.LocationModel

@using Logistics.Web.Models.Order;

@using (Html.BeginForm("Detail", "Order"))
{
    <style>
        .detail-labeloption #OrderByInfo {
            width:100%;
        }
    </style>
    <div class="window-content space">
        <div class="col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-6">
            <div class="window">
                <div class="window-title grad-lightgrey grad">
                    <div class="window-title-bar grad-titleshine grad">
                        <h2>Shipping Information</h2>
                    </div>
                </div>
                <div class="window-content space detail-locations">
                    <div class="detail-location-upper">
                        <div class="col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
                            <div class="detail-line">
                                @if (Model.IsUserAddressPickup)
                                {
                                    <h3>Pickup Location</h3>
                                }
                                else
                                {
                                    <h3>Delivery Location</h3>
                                }
                            </div>
                            @if (Model.UserAddress.Company != null)
                            {
                                <div class="detail-line">
                                    <strong>@Html.DisplayFor(model => model.UserAddress.Company)</strong>
                                </div>
                            }

                            <div class="detail-line">
                                <strong>
                                    @Html.DisplayFor(model => model.UserAddress.FirstName)
                                    @Html.DisplayFor(model => model.UserAddress.LastName)
                                </strong>
                            </div>
                            <div class="detail-line">
                                <div>
                                    @Html.DisplayFor(model => model.UserAddress.Address1)
                                </div>
                                <div>
                                    @Html.DisplayFor(model => model.UserAddress.Address2)
                                </div>
                            </div>
                            <div class="detail-line">
                                @Html.DisplayFor(model => model.UserAddress.City)
                                @Html.DisplayFor(model => model.UserAddress.StateProvinceName)
                                @Html.DisplayFor(model => model.UserAddress.CountryName)
                            </div>
                            <div class="detail-line">
                                @if (Model.UserAddress.CellPhoneNumber != null)
                                {
                                    <div>
                                        Cell phone: @Html.DisplayFor(model => model.UserAddress.CellPhoneNumber)
                                    </div>
                                }
                                @if (Model.UserAddress.PhoneNumber != null)
                                {
                                    <div>
                                        Secondary phone: @Html.DisplayFor(model => model.UserAddress.PhoneNumber)
                                    </div>
                                }
                            </div>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="detail-location-lower">
                        <div class="col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
                            <div class="detail-line">
                                @if (!Model.IsUserAddressPickup)
                                {
                                    <h3>Pickup Location</h3>
                                }
                                else
                                {
                                    <h3>Delivery Location</h3>
                                }
                            </div>

                            @if (Model.Address.Company != null)
                            {
                                <div class="detail-line">
                                    <strong>@Html.DisplayFor(model => model.Address.Company)</strong>
                                </div>
                            }

                            <div class="detail-line">
                                <strong>
                                    @Html.DisplayFor(model => model.Address.FirstName)
                                    @Html.DisplayFor(model => model.Address.LastName)
                                </strong>
                            </div>
                            <div class="detail-line">
                                <div>
                                    @Html.DisplayFor(model => model.Address.Address1)
                                </div>
                                <div>
                                    @Html.DisplayFor(model => model.Address.Address2)
                                </div>
                            </div>
                            <div class="detail-line">
                                @Html.DisplayFor(model => model.Address.City)
                                @Html.DisplayFor(model => model.Address.StateProvinceName)
                                @Html.DisplayFor(model => model.Address.CountryName)
                            </div>
                            <div class="detail-line">
                                @if (Model.Address.CellPhoneNumber != null)
                                {
                                    <div>
                                        Cell phone: @Html.DisplayFor(model => model.Address.CellPhoneNumber)
                                    </div>
                                }
                                @if (Model.Address.PhoneNumber != null)
                                {
                                    <div>
                                        Secondary phone: @Html.DisplayFor(model => model.Address.PhoneNumber)
                                    </div>
                                }
                            </div>
                            @if (!String.IsNullOrWhiteSpace(Model.AdditionalInstruction))
                            {
                                <div class="detail-line">
                                    <strong>@Model.AdditionalInstruction</strong>
                                </div>
                            }
                        </div>
                        
                        <div class="clear"></div>
                    </div>
                    
                    <div class="detail-line detail-edit">
                        <div class="col-ms-6 col-xs-6 col-sm-6 col-md-6 col-lg-6">
                            <input type="submit" name="@CommonValues.EditAddressFormKey" class="button-grey" value="Shipping Info" />
                        </div>
                        <div class="col-ms-6 col-xs-6 col-sm-6 col-md-6 col-lg-6">
                            <input type="button" class="cancel-location button-grey" value="Cancel Order" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-6">
            <div class="window">
                <div class="window-title grad-lightgrey grad">
                    <div class="window-title-bar grad-titleshine grad">
                        <h2>Your Order</h2>
                    </div>
                </div>
                <div class="window-content detail-labeloption space">
                    <div class="col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        You may choose a business or personnel name to be displayed at the "Order By" section of the shipping label:
                    </div>
                    <div class="col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        @Html.TextBoxFor(model => model.OrderByInfo)
                    </div>
                    <div class="col-ms-6 col-xs-6 col-sm-6 col-md-6 col-lg-6">
                        <input type="submit" name="@CommonValues.EditOrderByInfo" class="button-grey" value="Update" />
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="window-content space">
                    <div class="detail-packages">
                        @foreach (var package in Model.Packages)
                        {
                            <div class="detail-package">
                                <div class="col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-6">
                                    <h3>Package @package.Id: $@package.Charge</h3>
                                    <div>@package.Name</div>
                                    <div>@package.Comment</div>
                                </div>
                                <div class="clear"></div>
                                <div class="detail-edit">
                                    <div class="col-ms-6 col-xs-6 col-sm-6 col-md-6 col-lg-6">
                                        <input type="submit" name="@CommonValues.EditPackageFormKey" class="button-grey" data-value="@package.Id" value="Edit Package" />
                                    </div>
                                    <div class="col-ms-6 col-xs-6 col-sm-6 col-md-6 col-lg-6">
                                        <input type="submit" name="@CommonValues.RemovePackageFormKey" class="button-grey remove-package" data-value="@package.Id" value="Remove Package" />
                                    </div>
                                    <div class="clear"></div>
                                </div>
                                <div class="clear"></div>
                            </div>
                        }

                        <div class="detail-package-total">
                            <h3>Order Subtotal: $@Html.DisplayFor(model => Model.SubTotalExcSurchageTax)</h3>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>

    <div class="shippinginfo-continue">
        @Html.ActionLink("Finish", "Confirm", null, new { @class = "button-red" })
    </div>
    <div class="content-clear"></div>
}